package com.ruoyi.orderview.utils;

import com.ruoyi.orderview.domain.ProductionParam;
import com.ruoyi.orderview.mapper.ChartsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class StorageSelect {
    @Autowired
    private ChartsMapper chartsMapper;

    private Double storage=0.0;

    //private String[] type={"blade_amount","carton_amount","fertilizer_amount","graftingclip_amount","graftinglabel_amount","greenhousefilm_amount","pesticide_amount"
    //                        ,"plug_amount","regulator_amount","seed_amount", "stroma_amount"};
    private String[] type={"seed_amount","stroma_amount","plug_amount","pesticide_amount","regulator_amount","fertilizer_amount","graftingclip_amount",
                            "graftinglabel_amount","blade_amount","greenhousefilm_amount","carton_amount"};
    public List<Map<String,Double>> StoragesSelect(){
        System.out.println(type.length);
        List<Map<String,Double>> storages=new ArrayList<>();
        for(String a:type){
            storage=chartsMapper.selectStorages(a);
            if(storage==null){
                storage=0.0;
            }
            Map<String, Double> map = new HashMap<>();
            map.put(a,storage);
            storages.add(map);
        }
        return storages;

    }
}
